static-delta: Ignore symlinks when computing similar objects
authorJohn Hiesey <john@hiesey.com>
Wed, 26 Aug 2015 01:15:53 +0000 (18:15 -0700)
committerColin Walters <walters@verbum.org>
Wed, 26 Aug 2015 20:25:28 +0000 (16:25 -0400)
_ostree_delta_compute_similar_objects should not output symlinks.
Previously, a symlink in the "from" commit could be matched to a
real file in the "to" commit, since nothing was filtering symlinks
on the "from" side. This led to failures running the bzdiff
algorithm.

src/libostree/ostree-repo-static-delta-compilation-analysis.c

index 33647871cfb42f17db8968297ba4eb1d7fb3f79b..876c041f011ccfee04d990dedbd71a1342f9b9df 100644 (file)
@@ -76,20 +76,18 @@ build_content_sizenames_recurse (OstreeRepo                     *repo,
             {
               g_autoptr(GFileInfo) finfo = NULL;
 
-              csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
-              csizenames->checksum = g_strdup (checksum);
-              
-              /* Transfer ownership so things get cleaned up if we
-               * throw an exception below.
-               */
-              g_hash_table_replace (sizenames_map, csizenames->checksum, csizenames);
-
               if (!ostree_repo_load_file (repo, checksum,
                                           NULL, &finfo, NULL,
                                           cancellable, error))
                 goto out;
-              
+
+              if (g_file_info_get_file_type (finfo) != G_FILE_TYPE_REGULAR)
+                continue;
+
+              csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
+              csizenames->checksum = g_strdup (checksum);
               csizenames->size = g_file_info_get_size (finfo);
+              g_hash_table_replace (sizenames_map, csizenames->checksum, csizenames);
             }
 
           if (!csizenames->basenames)